Archive for May 26, 2016

Thursday, May 26, 2016

Dropbox’s Upcoming Kernel Extension

Damien DeVille (via Hacker News):

Traditionally, Dropbox operated entirely in user space as a program just like any other on your machine. With Dropbox Infinite, we’re going deeper: into the kernel—the core of the operating system. With Project Infinite, Dropbox is evolving from a process that passively watches what happens on your local disk to one that actively plays a role in your filesystem. We have invested the better part of two years making all the pieces fit together seamlessly. This post is a glimpse into our journey.

[…]

FUSE is an incredible technology, but as we gained a deeper understanding it became clear that it didn’t fully satisfy the two major constraints for our projects—world-class performance and rock-solid security.

[…]

We use the Kernel Authorization (or Kauth for short) kernel subsystem in our kernel extension to manage file authorizations within the BSD portion of the kernel. By listening to actions on the KAUTH_SCOPE_VNODE scope, we can detect and deny actions that happen in the Dropbox folder. In the examples cited above, for example, we are interested in the KAUTH_VNODE_DELETE and KAUTH_VNODE_ADD_FILE actions since they allow us to check whether a file or folder in a user’s shared folder is being deleted or moved. From there, it’s just a matter of checking with the user whether the operation was in fact intended and inform them of the consequences of the operations for other members of the folder.

Previously: Dropbox’s Project Infinite.

Building on Auto Layout

Bridger Maxwell:

It is common to use addConstraint directly, but Auto Layout is actually a great engine to build layout systems on top of. In this post I’ll talk about different abstraction layers on Auto Layout and show its advantages with my library StackLayout.

[…]

The simplest way we can build on Auto Layout is a thin syntactic layer for creating constraints that we still manage manually. Until iOS 9, the built-in way to create a constraint was quite verbose.

[…]

Higher up the abstraction scale is the Visual Format Language. When I interned at Apple on the Cocoa Frameworks team I helped with the initial implementation of Auto Layout and especially on the parser for the VFL. This lets you specify a few common layouts that can be written as ascii art.

I’ve experimented by reimplementing some of it in Swift using operator overloading. The idea is the same, but has the advantage of compile-time checking.