VirtualBox

儲存庫 vbox 的更動 77530


忽略:
時間撮記:
2019-3-1 下午02:39:03 (6 年 以前)
作者:
vboxsync
svn:sync-xref-src-repo-rev:
129133
訊息:

linux/vboxsf: Use vbxsf as prefix here - part II. bugref:9172

位置:
trunk/src/VBox/Additions/linux/sharedfolders
檔案:
修改 6 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Additions/linux/sharedfolders/dirops.c

    r77529 r77530  
    3939 *       reading in the whole directory on open.
    4040 */
    41 static int vbsf_dir_open_worker(struct vbsf_super_info *sf_g, struct sf_dir_info *sf_d,
    42                                 struct sf_inode_info *sf_i, const char *pszCaller)
     41static int vbsf_dir_open_worker(struct vbsf_super_info *sf_g, struct vbsf_dir_info *sf_d,
     42                                struct vbsf_inode_info *sf_i, const char *pszCaller)
    4343{
    4444    int rc;
     
    114114{
    115115    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    116     struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
    117     struct sf_dir_info *sf_d;
     116    struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode);
     117    struct vbsf_dir_info *sf_d;
    118118    int err;
    119119
     
    210210    loff_t cur;
    211211    struct vbsf_super_info *sf_g;
    212     struct sf_dir_info *sf_d;
    213     struct sf_inode_info *sf_i;
     212    struct vbsf_dir_info *sf_d;
     213    struct vbsf_inode_info *sf_i;
    214214    struct inode *inode;
    215215    struct list_head *pos, *list;
     
    217217    TRACE();
    218218
    219     inode = GET_F_DENTRY(dir)->d_inode;
    220     sf_i = GET_INODE_INFO(inode);
     219    inode = VBSF_GET_F_DENTRY(dir)->d_inode;
     220    sf_i = VBSF_GET_INODE_INFO(inode);
    221221    sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    222222    sf_d = dir->private_data;
     
    242242    list = &sf_d->info_list;
    243243    list_for_each(pos, list) {
    244         struct sf_dir_buf *b;
     244        struct vbsf_dir_buf *b;
    245245        SHFLDIRINFO *info;
    246246        loff_t i;
    247247
    248         b = list_entry(pos, struct sf_dir_buf, head);
     248        b = list_entry(pos, struct vbsf_dir_buf, head);
    249249        if (dir->f_pos >= cur + b->cEntries) {
    250250            cur += b->cEntries;
     
    387387     * Allocate memory for our additional inode info and create an inode.
    388388     */
    389     struct sf_inode_info *sf_new_i = (struct sf_inode_info *)kmalloc(sizeof(*sf_new_i), GFP_KERNEL);
     389    struct vbsf_inode_info *sf_new_i = (struct vbsf_inode_info *)kmalloc(sizeof(*sf_new_i), GFP_KERNEL);
    390390    if (sf_new_i) {
    391391        ino_t         iNodeNo = iunique(parent->i_sb, 1);
     
    409409            sf_new_i->handle        = SHFL_HANDLE_NIL;
    410410
    411             SET_INODE_INFO(pInode, sf_new_i);
     411            VBSF_SET_INODE_INFO(pInode, sf_new_i);
    412412            vbsf_init_inode(pInode, sf_new_i, pObjInfo, sf_g);
    413413
     
    448448{
    449449    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb);
    450     struct sf_inode_info   *sf_i = GET_INODE_INFO(parent);
     450    struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(parent);
    451451    SHFLSTRING             *path;
    452452    struct dentry          *dret;
     
    535535
    536536/**
    537  * This should allocate memory for sf_inode_info, compute a unique inode
     537 * This should allocate memory for vbsf_inode_info, compute a unique inode
    538538 * number, get an inode from vfs, initialize inode info, instantiate
    539539 * dentry.
     
    553553    if (pInode) {
    554554        /* Store this handle if we leave the handle open. */
    555         struct sf_inode_info *sf_new_i = GET_INODE_INFO(pInode);
     555        struct vbsf_inode_info *sf_new_i = VBSF_GET_INODE_INFO(pInode);
    556556        sf_new_i->handle = handle;
    557557        return 0;
     
    572572{
    573573    int rc, err;
    574     struct sf_inode_info *sf_parent_i = GET_INODE_INFO(parent);
     574    struct vbsf_inode_info *sf_parent_i = VBSF_GET_INODE_INFO(parent);
    575575    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb);
    576576    SHFLSTRING *path;
     
    724724    int rc, err;
    725725    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb);
    726     struct sf_inode_info *sf_parent_i = GET_INODE_INFO(parent);
     726    struct vbsf_inode_info *sf_parent_i = VBSF_GET_INODE_INFO(parent);
    727727    SHFLSTRING *path;
    728728
     
    743743
    744744            if (dentry->d_inode) {
    745                 struct sf_inode_info *sf_i = GET_INODE_INFO(dentry->d_inode);
     745                struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(dentry->d_inode);
    746746                sf_i->force_restat = 1;
    747747                sf_i->force_reread = 1;
     
    830830        err = -EINVAL;
    831831    } else {
    832         struct sf_inode_info *sf_old_i = GET_INODE_INFO(old_parent);
    833         struct sf_inode_info *sf_new_i = GET_INODE_INFO(new_parent);
     832        struct vbsf_inode_info *sf_old_i = VBSF_GET_INODE_INFO(old_parent);
     833        struct vbsf_inode_info *sf_new_i = VBSF_GET_INODE_INFO(new_parent);
    834834        /* As we save the relative path inside the inode structure, we need to change
    835835           this if the rename is successful. */
    836         struct sf_inode_info *sf_file_i = GET_INODE_INFO(old_dentry->d_inode);
     836        struct vbsf_inode_info *sf_file_i = VBSF_GET_INODE_INFO(old_dentry->d_inode);
    837837        SHFLSTRING *old_path;
    838838        SHFLSTRING *new_path;
     
    882882    int err;
    883883    int rc;
    884     struct sf_inode_info *sf_i;
     884    struct vbsf_inode_info *sf_i;
    885885    struct vbsf_super_info *sf_g;
    886886    SHFLSTRING *path, *ssymname;
     
    890890    TRACE();
    891891    sf_g = VBSF_GET_SUPER_INFO(parent->i_sb);
    892     sf_i = GET_INODE_INFO(parent);
     892    sf_i = VBSF_GET_INODE_INFO(parent);
    893893
    894894    BUG_ON(!sf_g);
  • trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c

    r77529 r77530  
    4545    struct inode *inode = dentry->d_inode;
    4646    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    47     struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
     47    struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode);
    4848    int error = -ENOMEM;
    4949    char *path = (char *)get_zeroed_page(GFP_KERNEL);
     
    5252    if (path) {
    5353        error = 0;
    54         rc = VbglR0SfReadLink(&g_SfClient, &sf_g->map, sf_i->path,
    55                       PATH_MAX, path);
     54        rc = VbglR0SfReadLink(&g_SfClient, &sf_g->map, sf_i->path, PATH_MAX, path);
    5655        if (RT_FAILURE(rc)) {
    5756            LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n", __func__, rc));
     
    9089{
    9190    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    92     struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
     91    struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode);
    9392    char *path;
    9493    int rc;
  • trunk/src/VBox/Additions/linux/sharedfolders/regops.c

    r77529 r77530  
    5858 * @param   pInodeInfo  The inode which handles to drop.
    5959 */
    60 void vbsf_handle_drop_chain(struct sf_inode_info *pInodeInfo)
     60void vbsf_handle_drop_chain(struct vbsf_inode_info *pInodeInfo)
    6161{
    6262    struct sf_handle *pCur, *pNext;
     
    8585 * @param   fFlagsClear The flags that must be clear.
    8686 */
    87 struct sf_handle *vbsf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear)
     87struct sf_handle *vbsf_handle_find(struct vbsf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear)
    8888{
    8989    struct sf_handle *pCur;
     
    163163 * @param   pHandle             The handle to add.
    164164 */
    165 void vbsf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle)
     165void vbsf_handle_append(struct vbsf_inode_info *pInodeInfo, struct sf_handle *pHandle)
    166166{
    167167#ifdef VBOX_STRICT
     
    246246};
    247247
    248 static int vbsf_reg_read_aux(const char *caller, struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r,
     248static int vbsf_reg_read_aux(const char *caller, struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r,
    249249                             void *buf, uint32_t *nread, uint64_t pos)
    250250{
     
    266266    loff_t orig_offset = *poffset;
    267267    loff_t offset = orig_offset;
    268     struct inode *inode = GET_F_DENTRY(in)->d_inode;
     268    struct inode *inode = VBSF_GET_F_DENTRY(in)->d_inode;
    269269    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    270     struct sf_reg_info *sf_r = in->private_data;
     270    struct vbsf_reg_info *sf_r = in->private_data;
    271271    ssize_t retval;
    272272    struct page *kpage = 0;
     
    445445 */
    446446static ssize_t vbsf_reg_read_fallback(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off,
    447                                       struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r)
     447                                      struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r)
    448448{
    449449    /*
     
    560560static ssize_t vbsf_reg_read(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)
    561561{
    562     struct inode *inode = GET_F_DENTRY(file)->d_inode;
     562    struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode;
    563563    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    564     struct sf_reg_info *sf_r = file->private_data;
     564    struct vbsf_reg_info *sf_r = file->private_data;
    565565    struct address_space *mapping = inode->i_mapping;
    566566
     
    684684 */
    685685static ssize_t vbsf_reg_write_fallback(struct file *file, const char /*__user*/ *buf, size_t size, loff_t *off, loff_t offFile,
    686                                        struct inode *inode, struct sf_inode_info *sf_i,
    687                                        struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r)
     686                                       struct inode *inode, struct vbsf_inode_info *sf_i,
     687                                       struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r)
    688688{
    689689    /*
     
    803803static ssize_t vbsf_reg_write(struct file *file, const char *buf, size_t size, loff_t * off)
    804804{
    805     struct inode           *inode   = GET_F_DENTRY(file)->d_inode;
    806     struct sf_inode_info   *sf_i    = GET_INODE_INFO(inode);
     805    struct inode           *inode   = VBSF_GET_F_DENTRY(file)->d_inode;
     806    struct vbsf_inode_info *sf_i    = VBSF_GET_INODE_INFO(inode);
    807807    struct vbsf_super_info *sf_g    = VBSF_GET_SUPER_INFO(inode->i_sb);
    808     struct sf_reg_info     *sf_r    = file->private_data;
     808    struct vbsf_reg_info     *sf_r    = file->private_data;
    809809    struct address_space   *mapping = inode->i_mapping;
    810810    loff_t                  pos;
     
    936936    int rc, rc_linux = 0;
    937937    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    938     struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
    939     struct sf_reg_info *sf_r;
     938    struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode);
     939    struct vbsf_reg_info *sf_r;
    940940#if   LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    941941    struct dentry *dentry = file_dentry(file);
     
    10961096static int vbsf_reg_release(struct inode *inode, struct file *file)
    10971097{
    1098     struct sf_reg_info *sf_r;
     1098    struct vbsf_reg_info *sf_r;
    10991099    struct vbsf_super_info *sf_g;
    1100     struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
     1100    struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode);
    11011101
    11021102    SFLOGFLOW(("vbsf_reg_release: inode=%p file=%p\n", inode, file));
     
    11451145#endif
    11461146        case SEEK_END: {
    1147             struct sf_reg_info *sf_r = file->private_data;
    1148             int rc = vbsf_inode_revalidate_with_handle(GET_F_DENTRY(file), sf_r->Handle.hHost, true /*fForce*/,
     1147            struct vbsf_reg_info *sf_r = file->private_data;
     1148            int rc = vbsf_inode_revalidate_with_handle(VBSF_GET_F_DENTRY(file), sf_r->Handle.hHost, true /*fForce*/,
    11491149                                 false /*fInodeLocked*/);
    11501150            if (rc == 0)
     
    12661266static int vbsf_readpage(struct file *file, struct page *page)
    12671267{
    1268     struct inode *inode = GET_F_DENTRY(file)->d_inode;
     1268    struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode;
    12691269    int           err;
    12701270
     
    12751275        if (pReq) {
    12761276            struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    1277             struct sf_reg_info     *sf_r = file->private_data;
     1277            struct vbsf_reg_info     *sf_r = file->private_data;
    12781278            uint32_t            cbRead;
    12791279            int                     vrc;
     
    13241324static int vbsf_writepage(struct page *page, struct writeback_control *wbc)
    13251325{
    1326     struct address_space *mapping  = page->mapping;
    1327     struct inode         *inode     = mapping->host;
    1328     struct sf_inode_info *sf_i      = GET_INODE_INFO(inode);
    1329     struct sf_handle     *pHandle  = vbsf_handle_find(sf_i, SF_HANDLE_F_WRITE, SF_HANDLE_F_APPEND);
    1330     int                   err;
     1326    struct address_space   *mapping = page->mapping;
     1327    struct inode           *inode   = mapping->host;
     1328    struct vbsf_inode_info *sf_i    = VBSF_GET_INODE_INFO(inode);
     1329    struct sf_handle       *pHandle = vbsf_handle_find(sf_i, SF_HANDLE_F_WRITE, SF_HANDLE_F_APPEND);
     1330    int                     err;
    13311331
    13321332    SFLOGFLOW(("vbsf_writepage: inode=%p page=%p off=%#llx pHandle=%p (%#llx)\n",
  • trunk/src/VBox/Additions/linux/sharedfolders/utils.c

    r77529 r77530  
    142142 * Initializes the @a inode attributes based on @a pObjInfo and @a sf_g options.
    143143 */
    144 void vbsf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g)
     144void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g)
    145145{
    146146    PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr;
     
    214214 * @todo sort out the inode locking situation.
    215215 */
    216 static void vbsf_update_inode(struct inode *pInode, struct sf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo,
     216static void vbsf_update_inode(struct inode *pInode, struct vbsf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo,
    217217                              struct vbsf_super_info *sf_g, bool fInodeLocked)
    218218{
     
    339339    struct inode *pInode = dentry ? dentry->d_inode : NULL;
    340340    if (pInode) {
    341         struct sf_inode_info   *sf_i = GET_INODE_INFO(pInode);
     341        struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode);
    342342        struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(pInode->i_sb);
    343343        AssertReturn(sf_i, -EINVAL);
     
    448448        err = -EINVAL;
    449449    } else {
    450         struct sf_inode_info   *sf_i = GET_INODE_INFO(pInode);
     450        struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode);
    451451        struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(pInode->i_sb);
    452452        AssertReturn(sf_i, -EINVAL);
     
    536536#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
    537537        if (dentry->d_inode) {
    538             struct sf_inode_info *pInodeInfo = GET_INODE_INFO(dentry->d_inode);
     538            struct vbsf_inode_info *pInodeInfo = VBSF_GET_INODE_INFO(dentry->d_inode);
    539539            if (pInodeInfo) {
    540540                vbsf_time_to_linux(&kstat->btime, &pInodeInfo->BirthTime);
     
    575575{
    576576    struct vbsf_super_info *sf_g;
    577     struct sf_inode_info *sf_i;
     577    struct vbsf_inode_info *sf_i;
    578578    union SetAttrReqs
    579579    {
     
    593593
    594594    sf_g = VBSF_GET_SUPER_INFO(dentry->d_inode->i_sb);
    595     sf_i = GET_INODE_INFO(dentry->d_inode);
     595    sf_i = VBSF_GET_INODE_INFO(dentry->d_inode);
    596596    cbReq = RT_MAX(sizeof(pReq->Info), sizeof(pReq->Create) + SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size);
    597597    pReq = (union SetAttrReqs *)VbglR0PhysHeapAlloc(cbReq);
     
    698698#endif /* >= 2.6.0 */
    699699
    700 static int vbsf_make_path(const char *caller, struct sf_inode_info *sf_i,
     700static int vbsf_make_path(const char *caller, struct vbsf_inode_info *sf_i,
    701701                          const char *d_name, size_t d_len, SHFLSTRING **result)
    702702{
     
    751751 * [vbsf_make_path] which will allocate SHFLSTRING and fill it in
    752752 */
    753 int vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i,
     753int vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i,
    754754                          struct dentry *dentry, SHFLSTRING **result)
    755755{
     
    887887}
    888888
    889 static struct sf_dir_buf *vbsf_dir_buf_alloc(void)
    890 {
    891     struct sf_dir_buf *b;
     889static struct vbsf_dir_buf *vbsf_dir_buf_alloc(void)
     890{
     891    struct vbsf_dir_buf *b;
    892892
    893893    TRACE();
     
    911911}
    912912
    913 static void vbsf_dir_buf_free(struct sf_dir_buf *b)
     913static void vbsf_dir_buf_free(struct vbsf_dir_buf *b)
    914914{
    915915    BUG_ON(!b || !b->buf);
     
    924924 * Free the directory buffer.
    925925 */
    926 void vbsf_dir_info_free(struct sf_dir_info *p)
     926void vbsf_dir_info_free(struct vbsf_dir_info *p)
    927927{
    928928    struct list_head *list, *pos, *tmp;
     
    931931    list = &p->info_list;
    932932    list_for_each_safe(pos, tmp, list) {
    933         struct sf_dir_buf *b;
    934 
    935         b = list_entry(pos, struct sf_dir_buf, head);
     933        struct vbsf_dir_buf *b;
     934
     935        b = list_entry(pos, struct vbsf_dir_buf, head);
    936936        vbsf_dir_buf_free(b);
    937937    }
     
    942942 * Empty (but not free) the directory buffer.
    943943 */
    944 void vbsf_dir_info_empty(struct sf_dir_info *p)
     944void vbsf_dir_info_empty(struct vbsf_dir_info *p)
    945945{
    946946    struct list_head *list, *pos, *tmp;
     
    948948    list = &p->info_list;
    949949    list_for_each_safe(pos, tmp, list) {
    950         struct sf_dir_buf *b;
    951         b = list_entry(pos, struct sf_dir_buf, head);
     950        struct vbsf_dir_buf *b;
     951        b = list_entry(pos, struct vbsf_dir_buf, head);
    952952        b->cEntries = 0;
    953953        b->cbUsed = 0;
     
    959959 * Create a new directory buffer descriptor.
    960960 */
    961 struct sf_dir_info *vbsf_dir_info_alloc(void)
    962 {
    963     struct sf_dir_info *p;
     961struct vbsf_dir_info *vbsf_dir_info_alloc(void)
     962{
     963    struct vbsf_dir_info *p;
    964964
    965965    TRACE();
     
    977977 * Search for an empty directory content buffer.
    978978 */
    979 static struct sf_dir_buf *vbsf_get_empty_dir_buf(struct sf_dir_info *sf_d)
     979static struct vbsf_dir_buf *vbsf_get_empty_dir_buf(struct vbsf_dir_info *sf_d)
    980980{
    981981    struct list_head *list, *pos;
     
    983983    list = &sf_d->info_list;
    984984    list_for_each(pos, list) {
    985         struct sf_dir_buf *b;
    986 
    987         b = list_entry(pos, struct sf_dir_buf, head);
     985        struct vbsf_dir_buf *b;
     986
     987        b = list_entry(pos, struct vbsf_dir_buf, head);
    988988        if (!b)
    989989            return NULL;
     
    999999/** @todo r=bird: Why on earth do we read in the entire directory???  This
    10001000 *        cannot be healthy for like big directory and such... */
    1001 int vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i, struct sf_dir_info *sf_d, SHFLHANDLE handle)
     1001int vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i, struct vbsf_dir_info *sf_d, SHFLHANDLE handle)
    10021002{
    10031003    int err;
     
    10151015    for (;;) {
    10161016        int rc;
    1017         struct sf_dir_buf *b;
     1017        struct vbsf_dir_buf *b;
    10181018
    10191019        b = vbsf_get_empty_dir_buf(sf_d);
     
    10741074
    10751075    Assert(dentry);
    1076     SFLOGFLOW(("vbsf_dentry_revalidate: %p %#x %s\n", dentry, flags, dentry->d_inode ? GET_INODE_INFO(dentry->d_inode)->path->String.ach : "<negative>"));
     1076    SFLOGFLOW(("vbsf_dentry_revalidate: %p %#x %s\n", dentry, flags,
     1077               dentry->d_inode ? VBSF_GET_INODE_INFO(dentry->d_inode)->path->String.ach : "<negative>"));
    10771078
    10781079    /*
     
    11041105             *       and ignore the dentry timestamp for positive entries.
    11051106             */
    1106             //struct sf_inode_info *sf_i = GET_INODE_INFO(pInode);
     1107            //struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode);
    11071108            unsigned long const     cJiffiesAge = vbsf_dentry_get_update_jiffies(dentry) - jiffies;
    11081109            struct vbsf_super_info *sf_g        = VBSF_GET_SUPER_INFO(dentry->d_sb);
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c

    r77529 r77530  
    6161uint32_t     g_fHostFeatures = 0;
    6262
    63 /** Protects all the sf_inode_info::HandleList lists. */
     63/** Protects all the vbsf_inode_info::HandleList lists. */
    6464spinlock_t   g_SfHandleLock;
    6565
     
    344344    struct dentry *droot;
    345345    struct inode *iroot;
    346     struct sf_inode_info *sf_i;
     346    struct vbsf_inode_info *sf_i;
    347347    struct vbsf_super_info *sf_g;
    348348    SHFLFSOBJINFO fsinfo;
     
    436436
    437437    vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);
    438     SET_INODE_INFO(iroot, sf_i);
     438    VBSF_SET_INODE_INFO(iroot, sf_i);
    439439
    440440#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
     
    492492#endif
    493493{
    494     struct sf_inode_info *sf_i;
     494    struct vbsf_inode_info *sf_i;
    495495
    496496    TRACE();
     
    510510     * Clean up our inode info.
    511511     */
    512     sf_i = GET_INODE_INFO(inode);
     512    sf_i = VBSF_GET_INODE_INFO(inode);
    513513    if (sf_i) {
    514         SET_INODE_INFO(inode, NULL);
     514        VBSF_SET_INODE_INFO(inode, NULL);
    515515
    516516        Assert(sf_i->u32Magic == SF_INODE_INFO_MAGIC);
     
    605605#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 23)
    606606    struct vbsf_super_info *sf_g;
    607     struct sf_inode_info *sf_i;
     607    struct vbsf_inode_info *sf_i;
    608608    struct inode *iroot;
    609609    SHFLFSOBJINFO fsinfo;
     
    626626        return -ENOSYS;
    627627
    628     sf_i = GET_INODE_INFO(iroot);
     628    sf_i = VBSF_GET_INODE_INFO(iroot);
    629629    err = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
    630630    BUG_ON(err != 0);
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h

    r77529 r77530  
    8383
    8484
    85 #define DIR_BUFFER_SIZE (16*_1K)
     85/* global variables */
     86extern VBGLSFCLIENT                    g_SfClient;
     87extern spinlock_t                      g_SfHandleLock;
     88
     89extern struct inode_operations         vbsf_dir_iops;
     90extern struct inode_operations         vbsf_lnk_iops;
     91extern struct inode_operations         vbsf_reg_iops;
     92extern struct file_operations          vbsf_dir_fops;
     93extern struct file_operations          vbsf_reg_fops;
     94extern struct dentry_operations        vbsf_dentry_ops;
     95extern struct address_space_operations vbsf_reg_aops;
     96
    8697
    8798/**
     
    131142 */
    132143struct sf_handle {
    133     /** List entry (head sf_inode_info::HandleList). */
     144    /** List entry (head vbsf_inode_info::HandleList). */
    134145    RTLISTNODE              Entry;
    135146    /** Host file/whatever handle. */
     
    142153#ifdef VBOX_STRICT
    143154    /** For strictness checks. */
    144     struct sf_inode_info   *pInodeInfo;
     155    struct vbsf_inode_info   *pInodeInfo;
    145156#endif
    146157};
     
    158169/** @} */
    159170
     171extern void              vbsf_handle_drop_chain(struct vbsf_inode_info *pInodeInfo);
     172extern struct sf_handle *vbsf_handle_find(struct vbsf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear);
     173extern uint32_t          vbsf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller);
     174extern void              vbsf_handle_append(struct vbsf_inode_info *pInodeInfo, struct sf_handle *pHandle);
     175
     176/**
     177 * Releases a handle.
     178 *
     179 * @returns New reference count.
     180 * @param   pHandle         The handle to release.
     181 * @param   sf_g            The info structure for the shared folder associated
     182 *                          with the handle.
     183 * @param   pszCaller       The caller name (for logging failures).
     184 */
     185DECLINLINE(uint32_t) vbsf_handle_release(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)
     186{
     187    uint32_t cRefs;
     188
     189    Assert((pHandle->fFlags & SF_HANDLE_F_MAGIC_MASK) == SF_HANDLE_F_MAGIC);
     190    Assert(pHandle->pInodeInfo);
     191    Assert(pHandle->pInodeInfo && pHandle->pInodeInfo->u32Magic == SF_INODE_INFO_MAGIC);
     192
     193    cRefs = ASMAtomicDecU32(&pHandle->cRefs);
     194    Assert(cRefs < _64M);
     195    if (cRefs)
     196        return cRefs;
     197    return vbsf_handle_release_slow(pHandle, sf_g, pszCaller);
     198}
     199
     200
    160201/**
    161202 * VBox specific per-inode information.
    162203 */
    163 struct sf_inode_info {
     204struct vbsf_inode_info {
    164205    /** Which file */
    165206    SHFLSTRING *path;
     
    189230#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined(KERNEL_FC6)
    190231/* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
    191 # define GET_INODE_INFO(i)       ((struct sf_inode_info *) (i)->i_private)
    192 # define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
     232# define VBSF_GET_INODE_INFO(i)       ((struct vbsf_inode_info *) (i)->i_private)
     233# define VBSF_SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
    193234#else
    194235/* vanilla kernel up to 2.6.18 */
    195 # define GET_INODE_INFO(i)       ((struct sf_inode_info *) (i)->u.generic_ip)
    196 # define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
    197 #endif
    198 
    199 struct sf_dir_info {
    200     /** @todo sf_handle. */
    201     struct list_head info_list;
    202 };
    203 
    204 struct sf_dir_buf {
    205     size_t cEntries;
    206     size_t cbFree;
    207     size_t cbUsed;
    208     void *buf;
    209     struct list_head head;
    210 };
    211 
    212 /**
    213  * VBox specific information for a regular file.
    214  */
    215 struct sf_reg_info {
    216     /** Handle tracking structure. */
    217     struct sf_handle        Handle;
    218 };
    219 
    220 /**
    221  * Sets the update-jiffies value for a dentry.
    222  *
    223  * This is used together with vbsf_super_info::ttl to reduce re-validation of
    224  * dentry structures while walking.
    225  *
    226  * This used to be living in d_time, but since 4.9.0 that seems to have become
    227  * unfashionable and d_fsdata is now used to for this purpose.  We do this all
    228  * the way back, since d_time seems only to have been used by the file system
    229  * specific code (at least going back to 2.4.0).
    230  */
    231 DECLINLINE(void) vbsf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet)
    232 {
    233     pDirEntry->d_fsdata = (void *)uToSet;
    234 }
    235 
    236 /**
    237  * Get the update-jiffies value for a dentry.
    238  */
    239 DECLINLINE(unsigned long) vbsf_dentry_get_update_jiffies(struct dentry *pDirEntry)
    240 {
    241     return (unsigned long)pDirEntry->d_fsdata;
    242 }
    243 
    244 /**
    245  * Increase the time-to-live of @a pDirEntry and all ancestors.
    246  * @param   pDirEntry           The directory entry cache entry which ancestors
    247  *                  we should increase the TTL for.
    248  */
    249 DECLINLINE(void) vbsf_dentry_chain_increase_ttl(struct dentry *pDirEntry)
    250 {
    251 #ifdef VBOX_STRICT
    252     struct super_block * const pSuper = pDirEntry->d_sb;
    253 #endif
    254     unsigned long const        uToSet = jiffies;
    255     do {
    256         Assert(pDirEntry->d_sb == pSuper);
    257         vbsf_dentry_set_update_jiffies(pDirEntry, uToSet);
    258         pDirEntry = pDirEntry->d_parent;
    259     } while (!IS_ROOT(pDirEntry));
    260 }
    261 
    262 /**
    263  * Increase the time-to-live of all ancestors.
    264  * @param   pDirEntry           The directory entry cache entry which ancestors
    265  *                  we should increase the TTL for.
    266  */
    267 DECLINLINE(void) vbsf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry)
    268 {
    269     Assert(!pDirEntry->d_parent || pDirEntry->d_parent->d_sb == pDirEntry->d_sb);
    270     pDirEntry = pDirEntry->d_parent;
    271     if (pDirEntry)
    272         vbsf_dentry_chain_increase_ttl(pDirEntry);
    273 }
    274 
    275 
    276 /* globals */
    277 extern VBGLSFCLIENT g_SfClient;
    278 extern spinlock_t g_SfHandleLock;
    279 
    280 
    281 /* forward declarations */
    282 extern struct inode_operations         vbsf_dir_iops;
    283 extern struct inode_operations         vbsf_lnk_iops;
    284 extern struct inode_operations         vbsf_reg_iops;
    285 extern struct file_operations          vbsf_dir_fops;
    286 extern struct file_operations          vbsf_reg_fops;
    287 extern struct dentry_operations        vbsf_dentry_ops;
    288 extern struct address_space_operations vbsf_reg_aops;
    289 
    290 extern void              vbsf_handle_drop_chain(struct sf_inode_info *pInodeInfo);
    291 extern struct sf_handle *vbsf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear);
    292 extern uint32_t          vbsf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller);
    293 extern void              vbsf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle);
    294 
    295 /**
    296  * Releases a handle.
    297  *
    298  * @returns New reference count.
    299  * @param   pHandle         The handle to release.
    300  * @param   sf_g            The info structure for the shared folder associated
    301  *                          with the handle.
    302  * @param   pszCaller       The caller name (for logging failures).
    303  */
    304 DECLINLINE(uint32_t) vbsf_handle_release(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)
    305 {
    306     uint32_t cRefs;
    307 
    308     Assert((pHandle->fFlags & SF_HANDLE_F_MAGIC_MASK) == SF_HANDLE_F_MAGIC);
    309     Assert(pHandle->pInodeInfo);
    310     Assert(pHandle->pInodeInfo && pHandle->pInodeInfo->u32Magic == SF_INODE_INFO_MAGIC);
    311 
    312     cRefs = ASMAtomicDecU32(&pHandle->cRefs);
    313     Assert(cRefs < _64M);
    314     if (cRefs)
    315         return cRefs;
    316     return vbsf_handle_release_slow(pHandle, sf_g, pszCaller);
    317 }
    318 
    319 extern void vbsf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO info, struct vbsf_super_info *sf_g);
    320 extern int  vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail);
     236# define VBSF_GET_INODE_INFO(i)       ((struct vbsf_inode_info *) (i)->u.generic_ip)
     237# define VBSF_SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
     238#endif
     239
     240extern void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO info, struct vbsf_super_info *sf_g);
    321241extern int  vbsf_inode_revalidate(struct dentry *dentry);
    322242extern int  vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced);
     
    330250extern int  vbsf_inode_setattr(struct dentry *dentry, struct iattr *iattr);
    331251#endif
    332 extern int  vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i,
     252
     253
     254/**
     255 * VBox specific information for a regular file.
     256 */
     257struct vbsf_reg_info {
     258    /** Handle tracking structure. */
     259    struct sf_handle        Handle;
     260};
     261
     262
     263struct vbsf_dir_info {
     264    /** @todo sf_handle. */
     265    struct list_head info_list;
     266};
     267
     268#define DIR_BUFFER_SIZE (16*_1K)
     269struct vbsf_dir_buf {
     270    size_t cEntries;
     271    size_t cbFree;
     272    size_t cbUsed;
     273    void *buf;
     274    struct list_head head;
     275};
     276
     277extern void vbsf_dir_info_free(struct vbsf_dir_info *p);
     278extern void vbsf_dir_info_empty(struct vbsf_dir_info *p);
     279extern struct vbsf_dir_info *vbsf_dir_info_alloc(void);
     280extern int  vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i,
     281                              struct vbsf_dir_info *sf_d, SHFLHANDLE handle);
     282
     283
     284/**
     285 * Sets the update-jiffies value for a dentry.
     286 *
     287 * This is used together with vbsf_super_info::ttl to reduce re-validation of
     288 * dentry structures while walking.
     289 *
     290 * This used to be living in d_time, but since 4.9.0 that seems to have become
     291 * unfashionable and d_fsdata is now used to for this purpose.  We do this all
     292 * the way back, since d_time seems only to have been used by the file system
     293 * specific code (at least going back to 2.4.0).
     294 */
     295DECLINLINE(void) vbsf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet)
     296{
     297    pDirEntry->d_fsdata = (void *)uToSet;
     298}
     299
     300/**
     301 * Get the update-jiffies value for a dentry.
     302 */
     303DECLINLINE(unsigned long) vbsf_dentry_get_update_jiffies(struct dentry *pDirEntry)
     304{
     305    return (unsigned long)pDirEntry->d_fsdata;
     306}
     307
     308/**
     309 * Increase the time-to-live of @a pDirEntry and all ancestors.
     310 * @param   pDirEntry           The directory entry cache entry which ancestors
     311 *                  we should increase the TTL for.
     312 */
     313DECLINLINE(void) vbsf_dentry_chain_increase_ttl(struct dentry *pDirEntry)
     314{
     315#ifdef VBOX_STRICT
     316    struct super_block * const pSuper = pDirEntry->d_sb;
     317#endif
     318    unsigned long const        uToSet = jiffies;
     319    do {
     320        Assert(pDirEntry->d_sb == pSuper);
     321        vbsf_dentry_set_update_jiffies(pDirEntry, uToSet);
     322        pDirEntry = pDirEntry->d_parent;
     323    } while (!IS_ROOT(pDirEntry));
     324}
     325
     326/**
     327 * Increase the time-to-live of all ancestors.
     328 * @param   pDirEntry           The directory entry cache entry which ancestors
     329 *                  we should increase the TTL for.
     330 */
     331DECLINLINE(void) vbsf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry)
     332{
     333    Assert(!pDirEntry->d_parent || pDirEntry->d_parent->d_sb == pDirEntry->d_sb);
     334    pDirEntry = pDirEntry->d_parent;
     335    if (pDirEntry)
     336        vbsf_dentry_chain_increase_ttl(pDirEntry);
     337}
     338
     339#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
     340# define VBSF_GET_F_DENTRY(f)   (f->f_path.dentry)
     341#else
     342# define VBSF_GET_F_DENTRY(f)   (f->f_dentry)
     343#endif
     344
     345
     346extern int  vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail);
     347extern int  vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i,
    333348                                  struct dentry *dentry, SHFLSTRING ** result);
    334349extern int  vbsf_nlscpy(struct vbsf_super_info *sf_g, char *name, size_t name_bound_len,
    335350                       const unsigned char *utf8_name, size_t utf8_len);
    336 extern void vbsf_dir_info_free(struct sf_dir_info *p);
    337 extern void vbsf_dir_info_empty(struct sf_dir_info *p);
    338 extern struct sf_dir_info *vbsf_dir_info_alloc(void);
    339 extern int  vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i,
    340                               struct sf_dir_info *sf_d, SHFLHANDLE handle);
     351
    341352
    342353#if 1
     
    352363#endif
    353364
    354 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
    355 # define GET_F_DENTRY(f)        (f->f_path.dentry)
    356 #else
    357 # define GET_F_DENTRY(f)        (f->f_dentry)
    358 #endif
    359 
    360365#endif /* !GA_INCLUDED_SRC_linux_sharedfolders_vfsmod_h */
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette