/** Handler for seeking in a FAF open file. * @author Renaud Lottiaux * * @param from Node sending the request * @param msgIn Request message */ void handle_faf_llseek (struct rpc_desc* desc, void *msgIn, size_t size) { struct faf_llseek_msg *msg = msgIn; long r = -EINVAL; loff_t result; r = sys_llseek (msg->server_fd, msg->offset_high, msg->offset_low, &result, msg->origin); rpc_pack_type(desc, r); rpc_pack_type(desc, result); }
/* Compatability functions - we used to pass 5 parameters as r0, r1, r2, *r3, *(r3+4) * We now use r0 - r4, and return an error if the old style calling standard is used. * Eventually these functions will disappear. */ asmlinkage int sys_compat_llseek (unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t *result, unsigned int origin, struct pt_regs *regs) { extern int sys_llseek (unsigned int, unsigned long, unsigned long, loff_t *, unsigned int); if (old_calling_standard (regs)) { printk (KERN_NOTICE "%s (%d): unsupported llseek call standard\n", current->comm, current->pid); return -EINVAL; } return sys_llseek (fd, offset_high, offset_low, result, origin); }
/* * 64bit lseek for UnixWare. */ int uw7_lseek64(int fd, u_int off, u_int off_hi, int orig) { loff_t result; int err; if (off_hi == (u_int)-1) off_hi = 0; err = sys_llseek(fd, (off_t) off_hi, off, &result, orig); if (err) return err; return (long)result; /* XXX: how does UnixWare return large results? */ }
/* * local file ftell */ s32 nv_lfile_ftell(FILE* fp) { #ifdef __KERNEL__ s32 ret; s32 seek =0; ret = sys_llseek(fp, 0, 0, &seek, SEEK_CUR); if(ret) { printf("sys_llseek error 0x%x\n",ret); return NV_ERROR; } return seek; #else return ftell(fp); #endif }
W64 sys_seek(int fd, W64 offset, unsigned int origin) { loff_t newoffs; int rc = sys_llseek(fd, HI32(offset), LO32(offset), &newoffs, origin); return (rc < 0) ? rc : newoffs; }
/* * Avoid bug in generic sys_llseek() that specifies offset_high and * offset_low as "unsigned long", thus making it possible to pass * a sign-extended high 32 bits in offset_low. */ COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high, unsigned int, offset_low, loff_t __user *, result, unsigned int, origin) { return sys_llseek(fd, offset_high, offset_low, result, origin); }