aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2016-03-25 15:39:29 -0500
committerPeter Seebach <peter.seebach@windriver.com>2016-03-25 15:47:00 -0500
commit22c338d3d8b70e0d814a9febdf437746f0361b0b (patch)
tree4de03df49530f54abd05baf469b66b0cbece2832
parent099c6b1a77b0d5a11b7c23ec49785dc255c37930 (diff)
downloadpseudo-22c338d3d8b70e0d814a9febdf437746f0361b0b.tar.gz
pseudo-22c338d3d8b70e0d814a9febdf437746f0361b0b.tar.bz2
pseudo-22c338d3d8b70e0d814a9febdf437746f0361b0b.zip
rework extended attribute support in database
extended attributes are a property of inodes, not paths. There can be multiple file database entries for a single inode, so switch to using inodes rather than paths. Still to-do: Delete them when deleting the last file with a given device and inode.
-rw-r--r--ChangeLog.txt4
-rw-r--r--pseudo.c43
-rw-r--r--pseudo_db.c180
-rw-r--r--pseudo_db.h18
-rw-r--r--pseudodb.c2
5 files changed, 141 insertions, 106 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 66a3a13..ed722a2 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,7 @@
+2016-03-24:
+ * (seebs) make xattr db use {dev, ino}. this includes an in-place
+ migration of the tables for existing databases.
+
2016-03-22:
* (seebs) extract variable name from message for remove_xattr so it
actually works.
diff --git a/pseudo.c b/pseudo.c
index 67ebb6a..52f649f 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -308,7 +308,7 @@ main(int argc, char *argv[]) {
pseudo_diag("Couldn't allocate data structure for path.\n");
exit(EXIT_FAILURE);
}
- if (pdb_find_file_path(msg, NULL)) {
+ if (pdb_find_file_path(msg)) {
pseudo_diag("Couldn't find a database entry for '%s'.\n", opt_i);
exit(EXIT_FAILURE);
}
@@ -440,7 +440,6 @@ int
pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **response_path, size_t *response_len) {
pseudo_msg_t msg_header;
pseudo_msg_t by_path = { .op = 0 }, by_ino = { .op = 0 };
- long long row = -1;
pseudo_msg_t db_header;
char *path_by_ino = 0;
char *oldpath = 0;
@@ -537,7 +536,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
*/
/* Lookup the full path, with inode and dev if available */
if (msg->pathlen && msg->dev && msg->ino) {
- if (!pdb_find_file_exact(msg, &row)) {
+ if (!pdb_find_file_exact(msg)) {
/* restore header contents */
by_path = *msg;
by_ino = *msg;
@@ -556,7 +555,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
if (msg->pathlen) {
/* for now, don't canonicalize paths anymore */
/* used to do it here, but now doing it in client */
- if (!pdb_find_file_path(msg, &row)) {
+ if (!pdb_find_file_path(msg)) {
by_path = *msg;
found_path = 1;
} else {
@@ -567,7 +566,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
}
/* search on original inode -- in case of mismatch */
if (msg->dev && msg->ino) {
- if (!pdb_find_file_dev(&by_ino, &row, &path_by_ino)) {
+ if (!pdb_find_file_dev(&by_ino, &path_by_ino)) {
found_ino = 1;
}
}
@@ -777,7 +776,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
if (!found_path) {
pseudo_debug(PDBGF_DB, "linking %s for OP_CREAT\n",
msg->pathlen ? msg->path : "no path");
- pdb_link_file(msg, NULL);
+ pdb_link_file(msg);
} else {
/* again, an error, but leaving it alone for now. */
pseudo_diag("creat ignored for existing file '%s'.\n",
@@ -812,7 +811,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
pseudo_debug(PDBGF_FILE, "(new) ");
pseudo_debug(PDBGF_DB, "linking %s for OP_[F]CHMOD\n",
msg->pathlen ? msg->path : "no path");
- pdb_link_file(msg, NULL);
+ pdb_link_file(msg);
}
break;
case OP_CHOWN: /* FALLTHROUGH */
@@ -844,7 +843,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
pseudo_debug(PDBGF_FILE, "(new) ");
pseudo_debug(PDBGF_DB, "linking %s for OP_[F]CHOWN\n",
msg->pathlen ? msg->path : "no path");
- pdb_link_file(msg, NULL);
+ pdb_link_file(msg);
}
break;
case OP_STAT: /* FALLTHROUGH */
@@ -914,7 +913,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
pseudo_debug(PDBGF_DB, "linking %s for %s\n",
msg->pathlen ? msg->path : "no path",
pseudo_op_name(msg->op));
- pdb_link_file(msg, NULL);
+ pdb_link_file(msg);
break;
case OP_RENAME:
/* a rename implies renaming an existing entry... and every
@@ -979,10 +978,10 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
pseudo_debug(PDBGF_DB, "linking %s for %s\n",
msg->pathlen ? msg->path : "no path",
pseudo_op_name(msg->op));
- pdb_link_file(msg, NULL);
+ pdb_link_file(msg);
break;
case OP_GET_XATTR:
- if (pdb_get_xattr(row, &oldpath, &oldpathlen)) {
+ if (pdb_get_xattr(msg, &oldpath, &oldpathlen)) {
msg->result = RESULT_FAIL;
} else {
*response_path = oldpath;
@@ -992,7 +991,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
}
break;
case OP_LIST_XATTR:
- if (pdb_list_xattr(row, &oldpath, &oldpathlen)) {
+ if (pdb_list_xattr(msg, &oldpath, &oldpathlen)) {
msg->result = RESULT_FAIL;
} else {
pseudo_debug(PDBGF_XATTR, "got %d bytes of xattrs to list: %.*s\n", (int) oldpathlen, (int) oldpathlen, oldpath);
@@ -1009,28 +1008,12 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
xattr_flags = XATTR_REPLACE;
}
case OP_SET_XATTR:
- /* we need a row entry to store xattr info */
- if (row == -1) {
-#ifdef PSEUDO_XATTRDB
- /* mark the entry as Not Reliable for purposes
- * of stat-type calls, since changes wouldn't
- * get reported to us.
- */
- msg->uid = (uid_t) -1;
- msg->gid = (gid_t) -1;
-#endif
- pseudo_debug(PDBGF_DB | PDBGF_XATTR, "linking %s (uid -1 if xattr) for %s, mode 0%o\n",
- msg->pathlen ? msg->path : "no path",
- pseudo_op_name(msg->op),
- (int) msg->mode);
- pdb_link_file(msg, &row);
- }
- if (pdb_set_xattr(row, oldpath, oldpathlen, xattr_flags)) {
+ if (pdb_set_xattr(msg, oldpath, oldpathlen, xattr_flags)) {
msg->result = RESULT_FAIL;
}
break;
case OP_REMOVE_XATTR:
- pdb_remove_xattr(row, oldpath, oldpathlen);
+ pdb_remove_xattr(msg, oldpath, oldpathlen);
break;
default:
pseudo_diag("unknown op from client %d, op %d [%s]\n",
diff --git a/pseudo_db.c b/pseudo_db.c
index c8b04cb..9829064 100644
--- a/pseudo_db.c
+++ b/pseudo_db.c
@@ -194,6 +194,47 @@ static struct sql_migration {
{ create_migration_table },
{ index_migration_table },
{ "ALTER TABLE files ADD deleting INTEGER;" },
+ /* oops. I made a design mistake, and the table is in the wrong
+ * format. But sqlite doesn't support modifying constraints on an
+ * existing table, or dropping columns. Soooooo.
+ *
+ * Also, you can't have a foreign key relationship to data which
+ * aren't actually unique, but the entire problem is that dev/ino
+ * are not unique.
+ *
+ * Note that the name entry is not really all that useful; it's mostly
+ * there to help with debugging, now.
+ */
+ {
+ "CREATE TABLE xattrs_new ("
+ "id INTEGER PRIMARY KEY, "
+ "dev INTEGER, "
+ "ino INTEGER, "
+ "name VARCHAR, "
+ "value VARCHAR"
+ ");",
+ },
+ {
+ "INSERT INTO xattrs_new (dev, ino, name, value) "
+ "SELECT "
+ "(SELECT dev FROM files WHERE id = file_id), "
+ "(SELECT ino FROM files WHERE id = file_id), "
+ "name, "
+ "value "
+ "FROM xattrs;"
+ },
+ {
+ "DROP TABLE xattrs;"
+ },
+ {
+ "ALTER TABLE xattrs_new RENAME TO xattrs;",
+ },
+ {
+ "CREATE INDEX xattrs__dev_ino ON xattrs (dev, ino);",
+ },
+ {
+ "CREATE UNIQUE INDEX xattrs__dev_ino_name ON xattrs (dev, ino, name);",
+ },
{ NULL },
}, log_migrations[] = {
{ create_migration_table },
@@ -465,11 +506,14 @@ make_tables(sqlite3 *db,
}
for (m = sql_migrations; m->sql; ++m)
;
- available_migrations = m - sql_migrations;
+ /* m points to the null, so available migrations is one lower */
+ available_migrations = m - sql_migrations - 1;
/* I am pretty sure this can never happen. */
if (version < -1)
version = -1;
/* I hope this can never happen. */
+ pseudo_debug(PDBGF_DB, "version %d, available_migrations %d\n",
+ version, available_migrations);
if (version >= available_migrations)
version = available_migrations - 1;
for (m = sql_migrations + (version + 1); m->sql; ++m) {
@@ -593,6 +637,7 @@ get_db(struct database_info *dbinfo) {
if (*(dbinfo->db))
return 0;
+ pseudo_debug(PDBGF_DB, "get_db(%s)\n", dbinfo->pathname);
dbfile = pseudo_localstatedir_path(dbinfo->pathname);
#ifdef USE_MEMORY_DB
if (!strcmp(dbinfo->pathname, ":memory:")) {
@@ -1389,7 +1434,7 @@ log_entry_free(log_entry *e) {
* or 'NAMELESS FILE'.
*/
int
-pdb_link_file(pseudo_msg_t *msg, long long *row) {
+pdb_link_file(pseudo_msg_t *msg) {
static sqlite3_stmt *insert;
int rc;
char *sql = "INSERT INTO files "
@@ -1430,10 +1475,6 @@ pdb_link_file(pseudo_msg_t *msg, long long *row) {
if (rc != SQLITE_DONE) {
dberr(file_db, "insert may have failed (rc %d)", rc);
}
- /* some users care what the row ID is */
- if (row) {
- *row = sqlite3_last_insert_rowid(file_db);
- }
sqlite3_reset(insert);
sqlite3_clear_bindings(insert);
return rc != SQLITE_DONE;
@@ -1833,9 +1874,12 @@ pdb_rename_file(const char *oldpath, pseudo_msg_t *msg) {
*/
int
pdb_renumber_all(dev_t from, dev_t to) {
- static sqlite3_stmt *update;
+ static sqlite3_stmt *files_update, *xattrs_update;
int rc;
- char *sql = "UPDATE files "
+ char *files_sql = "UPDATE files "
+ " SET dev = ? "
+ " WHERE dev = ?;";
+ char *xattrs_sql = "UPDATE xattrs "
" SET dev = ? "
" WHERE dev = ?;";
@@ -1843,31 +1887,52 @@ pdb_renumber_all(dev_t from, dev_t to) {
pseudo_diag("%s: database error.\n", __func__);
return 0;
}
- if (!update) {
- rc = sqlite3_prepare_v2(file_db, sql, strlen(sql), &update, NULL);
+ if (!files_update) {
+ rc = sqlite3_prepare_v2(file_db, files_sql, strlen(files_sql), &files_update, NULL);
if (rc) {
dberr(file_db, "couldn't prepare UPDATE statement");
return 1;
}
}
- rc = sqlite3_bind_int(update, 1, to);
+ if (!xattrs_update) {
+ rc = sqlite3_prepare_v2(file_db, xattrs_sql, strlen(xattrs_sql), &xattrs_update, NULL);
+ if (rc) {
+ dberr(file_db, "couldn't prepare UPDATE statement");
+ return 1;
+ }
+ }
+ rc = sqlite3_bind_int(files_update, 1, to);
if (rc) {
dberr(file_db, "error binding device numbers to update");
}
- rc = sqlite3_bind_int(update, 2, from);
+ rc = sqlite3_bind_int(files_update, 2, from);
+ if (rc) {
+ dberr(file_db, "error binding device numbers to update");
+ }
+ rc = sqlite3_bind_int(xattrs_update, 1, to);
+ if (rc) {
+ dberr(file_db, "error binding device numbers to update");
+ }
+ rc = sqlite3_bind_int(xattrs_update, 2, from);
if (rc) {
dberr(file_db, "error binding device numbers to update");
}
file_db_dirty = 1;
- rc = sqlite3_step(update);
+ pseudo_debug(PDBGF_DB, "updating device dev %llu to %llu\n",
+ (unsigned long long) from, (unsigned long long) to);
+ rc = sqlite3_step(files_update);
if (rc != SQLITE_DONE) {
dberr(file_db, "update may have failed: rc %d", rc);
}
- sqlite3_reset(update);
- sqlite3_clear_bindings(update);
- pseudo_debug(PDBGF_DB, "updating device dev %llu to %llu\n",
- (unsigned long long) from, (unsigned long long) to);
+ sqlite3_reset(files_update);
+ sqlite3_clear_bindings(files_update);
+ rc = sqlite3_step(xattrs_update);
+ if (rc != SQLITE_DONE) {
+ dberr(file_db, "update may have failed: rc %d", rc);
+ }
+ sqlite3_reset(xattrs_update);
+ sqlite3_clear_bindings(xattrs_update);
return rc != SQLITE_DONE;
}
@@ -1970,7 +2035,7 @@ pdb_update_file(pseudo_msg_t *msg) {
/* find file using both path AND dev/inode as key */
int
-pdb_find_file_exact(pseudo_msg_t *msg, long long *row) {
+pdb_find_file_exact(pseudo_msg_t *msg) {
static sqlite3_stmt *select;
int rc;
char *sql = "SELECT * FROM files WHERE path = ? AND dev = ? AND ino = ?;";
@@ -1998,9 +2063,6 @@ pdb_find_file_exact(pseudo_msg_t *msg, long long *row) {
rc = sqlite3_step(select);
switch (rc) {
case SQLITE_ROW:
- if (row) {
- *row = sqlite3_column_int64(select, 0);
- }
msg->uid = (unsigned long) sqlite3_column_int64(select, 4);
msg->gid = (unsigned long) sqlite3_column_int64(select, 5);
msg->mode = (unsigned long) sqlite3_column_int64(select, 6);
@@ -2024,7 +2086,7 @@ pdb_find_file_exact(pseudo_msg_t *msg, long long *row) {
/* find file using path as a key */
int
-pdb_find_file_path(pseudo_msg_t *msg, long long *row) {
+pdb_find_file_path(pseudo_msg_t *msg) {
static sqlite3_stmt *select;
int rc;
char *sql = "SELECT * FROM files WHERE path = ?;";
@@ -2055,9 +2117,6 @@ pdb_find_file_path(pseudo_msg_t *msg, long long *row) {
rc = sqlite3_step(select);
switch (rc) {
case SQLITE_ROW:
- if (row) {
- *row = sqlite3_column_int64(select, 0);
- }
msg->dev = sqlite3_column_int64(select, 2);
msg->ino = sqlite3_column_int64(select, 3);
msg->uid = sqlite3_column_int64(select, 4);
@@ -2133,7 +2192,7 @@ pdb_get_file_path(pseudo_msg_t *msg) {
/* find file using dev/inode as key */
int
-pdb_find_file_dev(pseudo_msg_t *msg, long long *row, char **path) {
+pdb_find_file_dev(pseudo_msg_t *msg, char **path) {
static sqlite3_stmt *select;
int rc;
char *sql = "SELECT * FROM files WHERE dev = ? AND ino = ?;";
@@ -2157,9 +2216,6 @@ pdb_find_file_dev(pseudo_msg_t *msg, long long *row, char **path) {
rc = sqlite3_step(select);
switch (rc) {
case SQLITE_ROW:
- if (row) {
- *row = sqlite3_column_int64(select, 0);
- }
msg->uid = (unsigned long) sqlite3_column_int64(select, 4);
msg->gid = (unsigned long) sqlite3_column_int64(select, 5);
msg->mode = (unsigned long) sqlite3_column_int64(select, 6);
@@ -2188,12 +2244,12 @@ pdb_find_file_dev(pseudo_msg_t *msg, long long *row, char **path) {
}
int
-pdb_get_xattr(long long file_id, char **value, size_t *len) {
+pdb_get_xattr(pseudo_msg_t *msg, char **value, size_t *len) {
static sqlite3_stmt *select;
int rc;
char *response;
size_t length;
- char *sql = "SELECT value FROM xattrs WHERE file_id = ? AND name = ?;";
+ char *sql = "SELECT value FROM xattrs WHERE dev = ? AND ino = ? AND name = ?;";
if (!file_db && get_dbs()) {
pseudo_diag("%s: database error.\n", __func__);
@@ -2206,9 +2262,10 @@ pdb_get_xattr(long long file_id, char **value, size_t *len) {
return 1;
}
}
- pseudo_debug(PDBGF_XATTR, "requested xattr named '%s' for file %lld\n", *value, file_id);
- sqlite3_bind_int(select, 1, file_id);
- rc = sqlite3_bind_text(select, 2, *value, -1, SQLITE_STATIC);
+ pseudo_debug(PDBGF_XATTR, "requested xattr named '%s' for ino %lld\n", *value, (long long) msg->ino);
+ sqlite3_bind_int(select, 1, msg->dev);
+ sqlite3_bind_int(select, 2, msg->ino);
+ rc = sqlite3_bind_text(select, 3, *value, -1, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr name to SELECT.");
return 1;
@@ -2249,22 +2306,13 @@ pdb_get_xattr(long long file_id, char **value, size_t *len) {
}
int
-pdb_list_xattr(long long file_id, char **value, size_t *len) {
+pdb_list_xattr(pseudo_msg_t *msg, char **value, size_t *len) {
static sqlite3_stmt *select;
size_t allocated = 0;
size_t used = 0;
char *buffer = 0;
int rc;
- char *sql = "SELECT name FROM xattrs WHERE file_id = ? ORDER BY name;";
-
- /* if we don't have a record of the file, it must not have
- * any extended attributes...
- */
- if (file_id == -1) {
- *value = NULL;
- *len = 0;
- return 0;
- }
+ char *sql = "SELECT name FROM xattrs WHERE dev = ? AND ino = ? ORDER BY name;";
if (!file_db && get_dbs()) {
pseudo_diag("%s: database error.\n", __func__);
@@ -2277,7 +2325,8 @@ pdb_list_xattr(long long file_id, char **value, size_t *len) {
return 1;
}
}
- sqlite3_bind_int(select, 1, file_id);
+ sqlite3_bind_int(select, 1, msg->dev);
+ sqlite3_bind_int(select, 2, msg->ino);
do {
rc = sqlite3_step(select);
if (rc == SQLITE_ROW) {
@@ -2314,10 +2363,10 @@ pdb_list_xattr(long long file_id, char **value, size_t *len) {
}
int
-pdb_remove_xattr(long long file_id, char *value, size_t len) {
+pdb_remove_xattr(pseudo_msg_t *msg, char *value, size_t len) {
static sqlite3_stmt *delete;
int rc;
- char *sql = "DELETE FROM xattrs WHERE file_id = ? AND name = ?;";
+ char *sql = "DELETE FROM xattrs WHERE dev = ? AND ino = ? AND name = ?;";
if (!file_db && get_dbs()) {
pseudo_diag("%s: database error.\n", __func__);
@@ -2330,8 +2379,9 @@ pdb_remove_xattr(long long file_id, char *value, size_t len) {
return 1;
}
}
- sqlite3_bind_int(delete, 1, file_id);
- rc = sqlite3_bind_text(delete, 2, value, len, SQLITE_STATIC);
+ sqlite3_bind_int(delete, 1, msg->dev);
+ sqlite3_bind_int(delete, 2, msg->ino);
+ rc = sqlite3_bind_text(delete, 3, value, len, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr name to DELETE.");
return 1;
@@ -2347,14 +2397,14 @@ pdb_remove_xattr(long long file_id, char *value, size_t len) {
}
int
-pdb_set_xattr(long long file_id, char *value, size_t len, int flags) {
+pdb_set_xattr(pseudo_msg_t *msg, char *value, size_t len, int flags) {
static sqlite3_stmt *select, *update, *insert;
int rc;
long long existing_row = -1;
- char *select_sql = "SELECT id FROM xattrs WHERE file_id = ? AND name = ?;";
+ char *select_sql = "SELECT id FROM xattrs WHERE dev = ? AND ino = ? AND name = ?;";
char *insert_sql = "INSERT INTO xattrs "
- " ( file_id, name, value ) "
- " VALUES (?, ?, ?);";
+ " ( dev, ino, name, value ) "
+ " VALUES (?, ?, ?, ?);";
char *update_sql = "UPDATE xattrs SET value = ? WHERE id = ?;";
char *vname = value;
size_t vlen;
@@ -2370,8 +2420,9 @@ pdb_set_xattr(long long file_id, char *value, size_t len, int flags) {
return 1;
}
}
- sqlite3_bind_int(select, 1, file_id);
- rc = sqlite3_bind_text(select, 2, value, -1, SQLITE_STATIC);
+ sqlite3_bind_int(select, 1, msg->dev);
+ sqlite3_bind_int(select, 2, msg->ino);
+ rc = sqlite3_bind_text(select, 3, value, -1, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr name to SELECT.");
return 1;
@@ -2404,8 +2455,8 @@ pdb_set_xattr(long long file_id, char *value, size_t len, int flags) {
vlen = strlen(value);
len = len - (vlen + 1);
value = value + vlen + 1;
- pseudo_debug(PDBGF_XATTR, "trying to set a value for %lld: name is '%s' [%d/%d bytes], value is '%s' [%d bytes]. Existing row %lld.\n",
- file_id, vname, (int) vlen, (int) (len + vlen + 1), value, (int) len, existing_row);
+ pseudo_debug(PDBGF_XATTR, "trying to set a value for ino %lld: name is '%s' [%d/%d bytes], value is '%s' [%d bytes]. Existing row %lld.\n",
+ (long long) msg->ino, vname, (int) vlen, (int) (len + vlen + 1), value, (int) len, existing_row);
if (existing_row != -1) {
/* update */
if (!update) {
@@ -2438,14 +2489,14 @@ pdb_set_xattr(long long file_id, char *value, size_t len, int flags) {
return 1;
}
}
- pseudo_debug(PDBGF_XATTR, "insert should be getting ID %lld\n", file_id);
- sqlite3_bind_int64(insert, 1, file_id);
- rc = sqlite3_bind_text(insert, 2, vname, -1, SQLITE_STATIC);
+ sqlite3_bind_int64(insert, 1, msg->dev);
+ sqlite3_bind_int64(insert, 2, msg->ino);
+ rc = sqlite3_bind_text(insert, 3, vname, -1, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr name to INSERT statement");
return 1;
}
- rc = sqlite3_bind_text(insert, 3, value, len, SQLITE_STATIC);
+ rc = sqlite3_bind_text(insert, 4, value, len, SQLITE_STATIC);
if (rc) {
dberr(file_db, "couldn't bind xattr value to INSERT statement");
return 1;
@@ -2466,7 +2517,7 @@ pdb_set_xattr(long long file_id, char *value, size_t len, int flags) {
* in for NFS usage.
*/
int
-pdb_find_file_ino(pseudo_msg_t *msg, long long *row) {
+pdb_find_file_ino(pseudo_msg_t *msg) {
static sqlite3_stmt *select;
int rc;
char *sql = "SELECT * FROM files WHERE ino = ?;";
@@ -2489,9 +2540,6 @@ pdb_find_file_ino(pseudo_msg_t *msg, long long *row) {
rc = sqlite3_step(select);
switch (rc) {
case SQLITE_ROW:
- if (row) {
- *row = sqlite3_column_int64(select, 0);
- }
msg->dev = (unsigned long) sqlite3_column_int64(select, 2);
msg->uid = (unsigned long) sqlite3_column_int64(select, 4);
msg->gid = (unsigned long) sqlite3_column_int64(select, 5);
diff --git a/pseudo_db.h b/pseudo_db.h
index 07c547b..a54f3c1 100644
--- a/pseudo_db.h
+++ b/pseudo_db.h
@@ -41,7 +41,7 @@ extern int pdb_maybe_backup(void);
extern int pdb_cancel_unlink_file(pseudo_msg_t *msg);
extern int pdb_did_unlink_file(char *path, int deleting);
extern int pdb_did_unlink_files(int deleting);
-extern int pdb_link_file(pseudo_msg_t *msg, long long *row);
+extern int pdb_link_file(pseudo_msg_t *msg);
extern int pdb_may_unlink_file(pseudo_msg_t *msg, int deleting);
extern int pdb_unlink_file(pseudo_msg_t *msg);
extern int pdb_unlink_file_dev(pseudo_msg_t *msg);
@@ -51,15 +51,15 @@ extern int pdb_update_inode(pseudo_msg_t *msg);
extern int pdb_unlink_contents(pseudo_msg_t *msg);
extern int pdb_rename_file(const char *oldpath, pseudo_msg_t *msg);
extern int pdb_renumber_all(dev_t from, dev_t to);
-extern int pdb_find_file_exact(pseudo_msg_t *msg, long long *row);
-extern int pdb_find_file_path(pseudo_msg_t *msg, long long *row);
-extern int pdb_find_file_dev(pseudo_msg_t *msg, long long *row, char **path);
-extern int pdb_find_file_ino(pseudo_msg_t *msg, long long *row);
+extern int pdb_find_file_exact(pseudo_msg_t *msg);
+extern int pdb_find_file_path(pseudo_msg_t *msg);
+extern int pdb_find_file_dev(pseudo_msg_t *msg, char **path);
+extern int pdb_find_file_ino(pseudo_msg_t *msg);
extern char *pdb_get_file_path(pseudo_msg_t *msg);
-extern int pdb_get_xattr(long long file_id, char **value, size_t *len);
-extern int pdb_list_xattr(long long file_id, char **value, size_t *len);
-extern int pdb_remove_xattr(long long file_id, char *value, size_t len);
-extern int pdb_set_xattr(long long file_id, char *value, size_t len, int flags);
+extern int pdb_get_xattr(pseudo_msg_t *msg, char **value, size_t *len);
+extern int pdb_list_xattr(pseudo_msg_t *msg, char **value, size_t *len);
+extern int pdb_remove_xattr(pseudo_msg_t *msg, char *value, size_t len);
+extern int pdb_set_xattr(pseudo_msg_t *msg, char *value, size_t len, int flags);
struct log_history;
typedef struct log_history *log_history;
diff --git a/pseudodb.c b/pseudodb.c
index 1be8651..9203648 100644
--- a/pseudodb.c
+++ b/pseudodb.c
@@ -38,7 +38,7 @@ main(int argc, char **argv) {
exit(1);
}
msg = pseudo_msg_new(0, argv[1]);
- rc = pdb_find_file_path(msg, NULL);
+ rc = pdb_find_file_path(msg);
if (rc) {
printf("error.\n");
return 1;