Skip to content
This repository was archived by the owner on Jul 8, 2024. It is now read-only.

changes required for VFS API in C##53

Merged
kivikakk merged 15 commits intomasterfrom
remove-vfsapi
Mar 4, 2019
Merged

changes required for VFS API in C##53
kivikakk merged 15 commits intomasterfrom
remove-vfsapi

Conversation

@kivikakk
Copy link
Contributor

@kivikakk kivikakk commented Feb 25, 2019

With these changes, the VFS API in C# (at github/VFSForGit#2 microsoft/VFSForGit#848) can be used.

                                                  pid_t and int should both be 4 bytes on most systems, but one's more obvious than the other.
@kivikakk kivikakk mentioned this pull request Feb 25, 2019
@kivikakk
Copy link
Contributor Author

@chrisd8088 fyi, this now has the part of work I talked about earlier (viz. 453409f, which removes VFS API-related things). Tests all pass and I think I did it right, but a once-over from you wouldn't go amiss, esp. in the testing machinery.

Copy link
Collaborator

@chrisd8088 chrisd8088 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So lovely to see this shrinking things down and making such a clean line between the two projects. Thank you, @kivikakk!

@@ -0,0 +1,103 @@
/* include/config.h.in. Generated from configure.ac by autoheader. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file was included as an addition in the commit by accident.

(As a sidebar, I initially considered putting *~ into .gitignore because I'm a vim user and it sometimes leaves these backup files lying around. But then somewhere I think I read advice to not put in your personal stuff in there, so I left it out. However, since the Linux kernel happily puts *~ in theirs, I think we'd be in good company if we wanted to add it. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very much so! I don't have such an ignore rule because I always configure my editors not to leave that junk lying around -- I think some part of autotools is producing this particular one, since it keeps coming back.

(I have a ~/.gitignore where I put stuff like .*.sw? (because vim) -- set excludesfile under [core] in your ~/.gitconfig to /home/xyzzy/.gitignore and it'll apply all the time!)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looking at my own ~/.gitignore I see I've already got it ignoring Vim's .*.swp backups, so this must indeed come out of autotools. Sigh.

t703-vfs-event-null.t \
t704-vfs-event-allow.t
else !ENABLE_VFSAPI
SKIP_TESTS = t[5-9]??
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't need to skip any VFS-related tests when --enable-vfs-api is not given, I'm pretty sure there's a line below this which can be removed (and the indentation changed), from:

		PROJFS_SKIP_TESTS="$(SKIP_TESTS) $$PROJFS_SKIP_TESTS" \
			$(PROVE) --exec $(SHELL) \
				$(PROJFS_PROVE_OPTS) $$prove_dir; \

to:

		$(PROVE) --exec $(SHELL) \
			$(PROJFS_PROVE_OPTS) $$prove_dir; \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks!

lib/projfs.c Outdated
ssize_t res = write(fd, bytes, count);
if (res == -1)
return errno;
bytes = (void *)(((uintptr_t)bytes) + res);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normal precedence should, I think, let you just do (void *)((uintptr_t)bytes + res), but I'm also wondering if it's slightly more readable to use (char*)bytes + res, which should be equivalent since sizeof(char) == 1 in C.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the power of math, people!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just watched s2.e5 Saints of Imperfection! Major spoilers!

AC_TYPE_SIZE_T
AC_TYPE_UINT64_T

# TODO: for VFS API but can't be conditional; remove if VFS API migrated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! Lovely to see this gone! 🙇

To build libprojfs with the VFSForGit API option (which is
required if you plan to run a VFSForGit "provider" such as MirrorProvider,
the test provider we are developing against for now), add the
`--enable-vfs-api` flag to the arguments for `configure`:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things are definitely getting tidier! 😄

event_msg_head="$event_msg_head, $4"
fi
event_msg_head="$event_msg_head: $code, "
event_msg_tail=""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much simpler and nicer!

@kivikakk kivikakk dismissed chrisd8088’s stale review February 28, 2019 01:30

Recommendations accepted!

Without the VFS API code, there is no longer a need to customize
the regular expression used to match symbol names for export in
our libtool invocation.
@chrisd8088
Copy link
Collaborator

chrisd8088 commented Mar 1, 2019

Hey @kivikakk -- I added a couple of cleanups to this branch which fall out of the VFS API removal. Hope they look OK!

And I also made a follow-on PR #54 which I think can be merged into this one, which simplifies the library by removing the projfs_i.h internal header file.

And there's a now further PR #55 which should first be merged into #54, if it looks OK to you!

chrisd8088 and others added 4 commits March 1, 2019 22:20
During the initial work on projection and while we had the VFS API
in this library, I envisioned a need for the VFS code to call an
internal, common function to make a directory (either projected, or
normal).

That need never materialized, so we can eliminate this function
entirely.
Without any shared code between the primary library and a VFS API,
there's no need for an internal header file at the moment, so we
can eliminate it.
As there is no compelling reason not to allow libprojfs callers
to specify the permission mode bits of a projected directory,
we can support this in our API, and defer to our callers (VFSForGit
in particular) to supply the directory permissions they expect or
require.
allow arbitrary permission modes on projected dirs
@kivikakk
Copy link
Contributor Author

kivikakk commented Mar 4, 2019

Nice! All looking good to me 😻

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api libprojfs API vfs VFSForGit API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants