/* * access() needs to use the real uid/gid, not the effective uid/gid. * We do this by temporarily clearing all FS-related capabilities and * switching the fsuid/fsgid around to the real ones. */ asmlinkage long sys_access(const char * filename, int mode) { int fd, error; struct file *file=0; int err = 0; struct _fabdef fab = cc$rms_fab; int sts; if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */ return -EINVAL; char vms_filename[256]; path_unix_to_vms(vms_filename, filename); convert_soname(vms_filename); fab.fab$l_fna = vms_filename; fab.fab$b_fns = strlen(fab.fab$l_fna); if ((sts = exe$open(&fab)) & 1) { exe$close(&fab); } else return -1; return 0; }
asmlinkage long sys_open(const char * filename, int flags, int mode) { int fd, error; struct file *file=0; int err = 0; #if 0 struct _fabdef fab = cc$rms_fab; #else struct _xabfhcdef cc$rms_xabfhc = {XAB$C_FHC,0,0,0,0,0,0,0,0,0,0,0}; struct _xabdatdef cc$rms_xabdat={XAB$C_DAT,XAB$C_DATLEN,0,0,0,0,0,0,0,0,0,0}; struct _fabdef * fab = kmalloc(sizeof(struct _fabdef), GFP_KERNEL); struct _rabdef * rab = kmalloc(sizeof(struct _rabdef), GFP_KERNEL); // remember too free next two struct _xabdatdef * dat = kmalloc(sizeof(struct _xabdatdef), GFP_KERNEL); struct _xabfhcdef * fhc = kmalloc(sizeof(struct _xabfhcdef), GFP_KERNEL); *fab = cc$rms_fab; *rab = cc$rms_rab; *dat = cc$rms_xabdat; *fhc = cc$rms_xabfhc; fab->fab$l_xab = dat; dat->xab$l_nxt = fhc; #endif int sts; char vms_filename[256]; path_unix_to_vms(vms_filename, filename); convert_soname(vms_filename); #if 0 long prev_xqp_fcb = get_xqp_prim_fcb(); long prev_x2p_fcb = get_x2p_prim_fcb(); fab.fab$l_fna = vms_filename; fab.fab$b_fns = strlen(fab.fab$l_fna); if ((sts = exe$open(&fab)) & 1) { long xqp_fcb = get_xqp_prim_fcb(); long x2p_fcb = get_x2p_prim_fcb(); extern int mount_root_ext2; if (mount_root_ext2==0 || xqp_fcb!=prev_xqp_fcb) file=xqp_fcb; else file=x2p_fcb; exe$close(&fab); } else return -1; #else fab->fab$l_fna = vms_filename; fab->fab$b_fns = strlen(fab->fab$l_fna); if ((sts = exe$open(fab)) & 1) { rab->rab$l_fab = fab; if ((sts = exe$connect(rab)) & 1) { } } else return -1; #endif fd = get_unused_fd(); #if 0 fd_install(fd, file); #else struct vms_fd * vms_fd = kmalloc(sizeof(struct vms_fd), GFP_KERNEL); vms_fd->vfd$l_is_cmu = 0; vms_fd->vfd$l_fd_p = rab; vms_fd->vfd$l_refcnt = 1; fd_install(fd, vms_fd); #endif return fd; }