int izo_upc_branch_redo(int minor, char *fsetname, char *branchname) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return -EIO; } hdr = upc_pack(IZO_UPC_BRANCH_REDO, strlen(branchname) + 1, branchname, fsetname, 0, NULL, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS); if (error) CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error); EXIT; return -error; }
int izo_upc_set_kmlsize(int minor, char *fsetname, __u8 uuid[16], __u64 kmlsize) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return -EIO; } hdr = upc_pack(IZO_UPC_SET_KMLSIZE, 0, NULL, fsetname, 0, NULL, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } memcpy(hdr->u_uuid, uuid, sizeof(hdr->u_uuid)); hdr->u_length = kmlsize; error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS); if (error) CERROR("%s: error %d\n", __FUNCTION__, error); EXIT; return -error; }
int izo_upc_repstatus(int minor, char * fsetname, struct izo_rcvd_rec *lr_server) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return -EIO; } hdr = upc_pack(IZO_UPC_REPSTATUS, 0, NULL, fsetname, sizeof(*lr_server), (char*)lr_server, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS); if (error) CERROR("%s: error %d\n", __FUNCTION__, error); EXIT; return -error; }
int izo_upc_backfetch(int minor, char *path, char *fsetname, struct lento_vfs_context *info) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return -EIO; } hdr = upc_pack(IZO_UPC_BACKFETCH, strlen(path), path, fsetname, sizeof(*info), (char *)info, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } /* This is currently synchronous, kml_reint_record blocks */ error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS); if (error) CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error); EXIT; return -error; }
int izo_upc_connect(int minor, __u64 ip_address, __u64 port, __u8 uuid[16], int client_flag) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return -EIO; } hdr = upc_pack(IZO_UPC_CONNECT, 0, NULL, NULL, 0, NULL, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } hdr->u_offset = ip_address; hdr->u_length = port; memcpy(hdr->u_uuid, uuid, sizeof(hdr->u_uuid)); hdr->u_first_recno = client_flag; error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS); if (error) { CERROR("%s: error %d\n", __FUNCTION__, error); } EXIT; return -error; }
int izo_upc_get_fileid(int minor, __u32 reclen, char *rec, __u32 pathlen, char *path, char *fsetname) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return -EIO; } hdr = upc_pack(IZO_UPC_GET_FILEID, pathlen, path, fsetname, reclen, rec, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } CDEBUG(D_UPCALL, "path %s\n", path); error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS); if (error) CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error); EXIT; return -error; }
int izo_upc_open(int minor, __u32 pathlen, char *path, char *fsetname, struct lento_vfs_context *info) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return -EIO; } hdr = upc_pack(IZO_UPC_OPEN, pathlen, path, fsetname, sizeof(*info), (char*)info, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } CDEBUG(D_UPCALL, "path %s\n", path); error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS); if (error) CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error); EXIT; return -error; }
int izo_upc_kml_truncate(int minor, __u64 length, __u32 last_recno, char *fsetname) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return 0; } hdr = upc_pack(IZO_UPC_KML_TRUNC, 0, NULL, fsetname, 0, NULL, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } hdr->u_length = length; hdr->u_last_recno = last_recno; CDEBUG(D_UPCALL, "KML TRUNCATE: fileset %s, length %Lu, " "last recno %d, minor %d\n", fsetname, hdr->u_length, hdr->u_last_recno, minor); error = izo_upc_upcall(minor, &size, hdr, ASYNCHRONOUS); EXIT; return error; }
/* the upcalls */ int izo_upc_kml(int minor, __u64 offset, __u32 first_recno, __u64 length, __u32 last_recno, char *fsetname) { int size; int error; struct izo_upcall_hdr *hdr; ENTRY; if (!presto_lento_up(minor)) { EXIT; return 0; } hdr = upc_pack(IZO_UPC_KML, 0, NULL, fsetname, 0, NULL, &size); if (!hdr || IS_ERR(hdr)) { EXIT; return -PTR_ERR(hdr); } hdr->u_offset = offset; hdr->u_first_recno = first_recno; hdr->u_length = length; hdr->u_last_recno = last_recno; CDEBUG(D_UPCALL, "KML: fileset %s, offset %Lu, length %Lu, " "first %u, last %d; minor %d\n", fsetname, hdr->u_offset, hdr->u_length, hdr->u_first_recno, hdr->u_last_recno, minor); error = izo_upc_upcall(minor, &size, hdr, ASYNCHRONOUS); EXIT; return -error; }
/* talk to Lento about the permit */ static int presto_permit_upcall(struct dentry *dentry) { int rc; char *path, *buffer; int pathlen; int minor; int fsetnamelen; struct presto_file_set *fset = NULL; ENTRY; if ( (minor = presto_i2m(dentry->d_inode)) < 0) { EXIT; return -EINVAL; } fset = presto_fset(dentry); if (!fset) { EXIT; return -ENOTCONN; } if ( !presto_lento_up(minor) ) { if ( fset->fset_flags & FSET_STEAL_PERMIT ) { EXIT; return 0; } else { EXIT; return -ENOTCONN; } } PRESTO_ALLOC(buffer, PAGE_SIZE); if ( !buffer ) { CERROR("PRESTO: out of memory!\n"); EXIT; return -ENOMEM; } path = presto_path(dentry, fset->fset_dentry, buffer, PAGE_SIZE); pathlen = MYPATHLEN(buffer, path); fsetnamelen = strlen(fset->fset_name); rc = izo_upc_permit(minor, dentry, pathlen, path, fset->fset_name); PRESTO_FREE(buffer, PAGE_SIZE); EXIT; return rc; }