int umsdos_newentry (struct dentry *parent, struct umsdos_info *info) { int err, ret = -EEXIST; err = umsdos_find (parent, info); if (err && err == -ENOENT) { ret = umsdos_writeentry (parent, info, 0); Printk (("umsdos_writeentry EMD ret = %d\n", ret)); } return ret; }
/* Add a new entry in the emd file Return 0 if ok or a negative error code. Return -EEXIST if the entry already exist. Complete the information missing in info. */ int umsdos_newentry ( struct inode *dir, struct umsdos_info *info) { struct inode *emd_dir; int ret = umsdos_find (dir,info,&emd_dir); if (ret == 0){ ret = -EEXIST; }else if (ret == -ENOENT){ ret = umsdos_writeentry(dir,emd_dir,info,0); PRINTK (("umsdos_newentry EDM ret = %d\n",ret)); } iput (emd_dir); return ret; }
int umsdos_delentry (struct dentry *parent, struct umsdos_info *info, int isdir) { int ret; ret = umsdos_find (parent, info); if (ret) goto out; if (info->entry.name_len == 0) goto out; if ((isdir != 0) != (S_ISDIR (info->entry.mode) != 0)) { if (S_ISDIR (info->entry.mode)) { ret = -EISDIR; } else { ret = -ENOTDIR; } goto out; } ret = umsdos_writeentry (parent, info, 1); out: return ret; }
/* Remove an entry from the emd file Return 0 if ok, a negative error code otherwise. Complete the information missing in info. */ int umsdos_delentry ( struct inode *dir, struct umsdos_info *info, int isdir) { struct inode *emd_dir; int ret = umsdos_find (dir,info,&emd_dir); if (ret == 0){ if (info->entry.name_len != 0){ if ((isdir != 0) != (S_ISDIR(info->entry.mode) != 0)){ if (S_ISDIR(info->entry.mode)){ ret = -EISDIR; }else{ ret = -ENOTDIR; } }else{ ret = umsdos_writeentry(dir,emd_dir,info,1); } } } iput(emd_dir); return ret; }