Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

VFS API

hojo edited this page Sep 26, 2012 · 1 revision

VFS API

This API allows a caller to specify files by their absolute and relative paths (e.g. "../foo/bar"). It leverages the Delimiter API from S3 or the native directory ability of CDMI to accomplish this. It also enables features like on-the-fly encryption, buffered I/O, etc.

Operations to manipulate virtual directories

VFS API virtual directory functions

  • dpl_iname() Returns name of object given an inode name.
  • dpl_namei() Returns an inode name given the name of an object file.
  • dpl_cwd() Sets the current working directory.
  • dpl_opendir() Opens a directory and returns the directory handle.
  • dpl_readdir() Returns directory entries.
  • dpl_eof() Reports the end of a directory listing.
  • dpl_closedir() Closes a directory.
  • dpl_chdir() Changes the directory.
  • dpl_mkdir() Makes a directory.
  • dpl_mknod() Makes an object file.
  • dpl_rmdir() Removes a directory.

VFS API virtual directory input parameters

  • ctx The droplet context.
  • bucket A container for objects in storage.
  • ino An index node name.
  • path_len Pre-allocated length for an object path.
  • path (IN/OUT) Pre-allocated name for the object.
  • locator Reference to an object with the format bucket:path.
  • dir_hdl Directory handle.
  • dirent Directory entries.

VFS API virtual directory output parameters

  • parent_inop Parent inode of the object.
  • obj_inop The object inode.
  • obj_typep The object context type.
  • dir_hdlp Directory handle.

VFS API virtual directory prototypes

dpl_status_t 
dpl_iname(dpl_ctx_t *ctx, 
          char *bucket, 
          dpl_ino_t ino, 
          char *path, 
          u_int path_len);

dpl_status_t 
dpl_namei(dpl_ctx_t *ctx, 
          char *path, 
          char *bucket, 
          dpl_ino_t ino, 
          dpl_ino_t *parent_inop, 
          dpl_ino_t *obj_inop, 
          dpl_ftype_t *obj_typep);
          
dpl_ino_t 
dpl_cwd(dpl_ctx_t *ctx, 
        char *bucket);

dpl_status_t 
dpl_opendir(dpl_ctx_t *ctx, 
            char *locator, 
            void **dir_hdlp);

dpl_status_t 
dpl_readdir(void *dir_hdl, 
            dpl_dirent_t *dirent);

int 
dpl_eof(void *dir_hdl);

void 
dpl_closedir(void *dir_hdl);

dpl_status_t 
dpl_chdir(dpl_ctx_t *ctx, 
          char *locator);

dpl_status_t 
dpl_mkdir(dpl_ctx_t *ctx, 
          char *locator);

dpl_status_t 
dpl_mknod(dpl_ctx_t *ctx, 
          char *locator);

dpl_status_t 
dpl_rmdir(dpl_ctx_t *ctx, 
          char *locator);

Operations to manipulate vfiles

VFS API vfile functions

  • dpl_close() Closes a file.
  • dpl_openwrite() Opens a file for writing.
  • dpl_write() Writes to a file.
  • dpl_openread() Opens a file for reading.
  • dpl_openread_range() Opens a file for reading within a restricted range.
  • dpl_unlink() Removes a file.
  • dpl_getattr() Gets file metadata.
  • dpl_setattr() Sets file metadata.
  • dpl_fgenurl() Generates object URLs.
  • dpl_fcopy() Copies objects on the server side.

VFS API vfile input parameters

  • vfile The vfile handle.
  • ctx The droplet context.
  • locator Reference to an object with the format bucket:path.
  • flags Open flags.
  • metadata Object metadata.
  • canned_acl Simplified
  • data_len The object length.
  • buf Body of the vfile.
  • len Length of the vfile.
  • condition Condition for reading a data chunk.
  • buffer_func Callback function for every chunk of data in the HTTP response.
  • cb_arg User-defined callback argument (closure).
  • start Start of the range for a data chunk.
  • end End of the range for a data chunk.
  • expires Expiration time for a generated URL.
  • src_locator Copy operation reference to the source location of an object using the format bucket:path.
  • dst_locator Copy operation reference to the destination location of an object using the format bucket:path.

VFS API vfile output parameters

  • vfilep The vfile handle.
  • metadatap Returns object metadata. Caller must release resource after use by calling dpl_dict_free().
  • data_bufp Returns object body. Caller must release resource after use by calling dpl_free().
  • data_lenp Returns object length.

VFS API vfile prototypes

dpl_status_t 
dpl_close(dpl_vfile_t *vfile);

dpl_status_t 
dpl_openwrite(dpl_ctx_t *ctx, 
              char *locator, 
              u_int flags, 
              dpl_dict_t *metadata, 
              dpl_canned_acl_t canned_acl, 
              u_int data_len, 
              dpl_vfile_t **vfilep);

dpl_status_t 
dpl_write(dpl_vfile_t *vfile, 
          char *buf, 
          u_int len);

dpl_status_t 
dpl_openread(dpl_ctx_t *ctx, 
             char *locator, 
             u_int flags, 
             dpl_condition_t *condition, 
             dpl_buffer_func_t buffer_func, 
             void *cb_arg, 
             dpl_dict_t **metadatap);

dpl_status_t 
dpl_openread_range(dpl_ctx_t *ctx, 
                   char *locator, 
                   u_int flags, 
                   dpl_condition_t *condition, 
                   int start, 
                   int end, 
                   char **data_bufp, 
                   u_int *data_lenp, 
                   dpl_dict_t **metadatap);

dpl_status_t 
dpl_unlink(dpl_ctx_t *ctx, 
           char *locator);

dpl_status_t 
dpl_getattr(dpl_ctx_t *ctx, 
            char *locator, 
            dpl_dict_t **metadatap);

dpl_status_t 
dpl_setattr(dpl_ctx_t *ctx, 
            char *locator, 
            dpl_dict_t *metadata);

dpl_status_t 
dpl_fgenurl(dpl_ctx_t *ctx, 
            char *locator, 
            time_t expires, 
            char *buf, 
            u_int len, 
            u_int *lenp);

dpl_status_t 
dpl_fcopy(dpl_ctx_t *ctx, 
          char *src_locator, 
          char *dst_locator);