* other in repair - now there is just the one.
*/
int
-libxfs_inode_alloc(
- xfs_trans_t **tp,
- xfs_inode_t *pip,
+libxfs_dir_ialloc(
+ xfs_trans_t **tpp,
+ xfs_inode_t *dp,
mode_t mode,
nlink_t nlink,
xfs_dev_t rdev,
struct fsxattr *fsx,
xfs_inode_t **ipp)
{
- xfs_buf_t *ialloc_context;
+ xfs_trans_t *tp;
xfs_inode_t *ip;
- int error;
+ xfs_buf_t *ialloc_context = NULL;
+ int code;
- ialloc_context = (xfs_buf_t *)0;
- error = libxfs_ialloc(*tp, pip, mode, nlink, rdev, cr, fsx,
+ tp = *tpp;
+
+ code = libxfs_ialloc(tp, dp, mode, nlink, rdev, cr, fsx,
&ialloc_context, &ip);
- if (error) {
+ if (code) {
*ipp = NULL;
- return error;
+ return code;
}
if (!ialloc_context && !ip) {
*ipp = NULL;
if (ialloc_context) {
- xfs_trans_bhold(*tp, ialloc_context);
+ xfs_trans_bhold(tp, ialloc_context);
- error = xfs_trans_roll(tp);
- if (error) {
+ code = xfs_trans_roll(&tp);
+ if (code) {
fprintf(stderr, _("%s: cannot duplicate transaction: %s\n"),
- progname, strerror(error));
+ progname, strerror(code));
exit(1);
}
- xfs_trans_bjoin(*tp, ialloc_context);
- error = libxfs_ialloc(*tp, pip, mode, nlink, rdev, cr,
+ xfs_trans_bjoin(tp, ialloc_context);
+ code = libxfs_ialloc(tp, dp, mode, nlink, rdev, cr,
fsx, &ialloc_context, &ip);
if (!ip)
- error = -ENOSPC;
- if (error)
- return error;
+ code = -ENOSPC;
+ if (code) {
+ *tpp = tp;
+ *ipp = NULL;
+ return code;
+ }
}
*ipp = ip;
- return error;
+ *tpp = tp;
+ return code;
}
void
case IF_REGULAR:
buf = newregfile(pp, &len);
tp = getres(mp, XFS_B_TO_FSB(mp, len));
- error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0,
+ error = -libxfs_dir_ialloc(&tp, pip, mode|S_IFREG, 1, 0,
&creds, fsxp, &ip);
if (error)
fail(_("Inode allocation failed"), error);
}
tp = getres(mp, XFS_B_TO_FSB(mp, llen));
- error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0,
+ error = -libxfs_dir_ialloc(&tp, pip, mode|S_IFREG, 1, 0,
&creds, fsxp, &ip);
if (error)
fail(_("Inode pre-allocation failed"), error);
tp = getres(mp, 0);
majdev = getnum(getstr(pp), 0, 0, false);
mindev = getnum(getstr(pp), 0, 0, false);
- error = -libxfs_inode_alloc(&tp, pip, mode|S_IFBLK, 1,
+ error = -libxfs_dir_ialloc(&tp, pip, mode|S_IFBLK, 1,
IRIX_MKDEV(majdev, mindev), &creds, fsxp, &ip);
if (error) {
fail(_("Inode allocation failed"), error);
tp = getres(mp, 0);
majdev = getnum(getstr(pp), 0, 0, false);
mindev = getnum(getstr(pp), 0, 0, false);
- error = -libxfs_inode_alloc(&tp, pip, mode|S_IFCHR, 1,
+ error = -libxfs_dir_ialloc(&tp, pip, mode|S_IFCHR, 1,
IRIX_MKDEV(majdev, mindev), &creds, fsxp, &ip);
if (error)
fail(_("Inode allocation failed"), error);
case IF_FIFO:
tp = getres(mp, 0);
- error = -libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1, 0,
+ error = -libxfs_dir_ialloc(&tp, pip, mode|S_IFIFO, 1, 0,
&creds, fsxp, &ip);
if (error)
fail(_("Inode allocation failed"), error);
buf = getstr(pp);
len = (int)strlen(buf);
tp = getres(mp, XFS_B_TO_FSB(mp, len));
- error = -libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1, 0,
+ error = -libxfs_dir_ialloc(&tp, pip, mode|S_IFLNK, 1, 0,
&creds, fsxp, &ip);
if (error)
fail(_("Inode allocation failed"), error);
break;
case IF_DIRECTORY:
tp = getres(mp, 0);
- error = -libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, 0,
+ error = -libxfs_dir_ialloc(&tp, pip, mode|S_IFDIR, 1, 0,
&creds, fsxp, &ip);
if (error)
fail(_("Inode allocation failed"), error);
memset(&creds, 0, sizeof(creds));
memset(&fsxattrs, 0, sizeof(fsxattrs));
- error = -libxfs_inode_alloc(&tp, NULL, S_IFREG, 1, 0,
+ error = -libxfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0,
&creds, &fsxattrs, &rbmip);
if (error) {
fail(_("Realtime bitmap inode allocation failed"), error);
libxfs_trans_log_inode(tp, rbmip, XFS_ILOG_CORE);
libxfs_log_sb(tp);
mp->m_rbmip = rbmip;
- error = -libxfs_inode_alloc(&tp, NULL, S_IFREG, 1, 0,
+ error = -libxfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0,
&creds, &fsxattrs, &rsumip);
if (error) {
fail(_("Realtime summary inode allocation failed"), error);